package com.dqs.springframework.exceptionhandle;

import com.dqs.comment.result.Result;
import com.dqs.comment.result.ResultEnum;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobeExceptionHandle {

    @ExceptionHandler(Exception.class)
    public Result<?> exceptionHandle(Exception e, HttpServletResponse resp){
        resp.setStatus(ResultEnum.INTERNAL_ERROR.getCode());
        e.printStackTrace();
        return Result.error(ResultEnum.INTERNAL_ERROR);
    }


}
